﻿using UnityEngine;
using System.Collections;

public class TestCodeUiPanelDepth : MonoBehaviour {


    public UIPanel[] testList;

	// Use this for initialization
	void Start () {
	
        for(int i = 0 ; i < testList.Length ; i++)
        {
            Vector3 pos = testList[i].transform.localPosition;
            pos.z = i * -300;
            pos.x = -962f + (i * 200); 
            testList[i].transform.localPosition = pos;

            testList[i].transform.localRotation = Quaternion.Euler(new Vector3(0, 20, 0));

            testList[i].depth = (int)pos.z * -1;
        }
	}
	
	// Update is called once per frame
	void Update () {

        for (int i = 0; i < testList.Length; i++)
        {
            Vector3 pos = testList[i].transform.localPosition;
            pos.z -= 300 * Time.deltaTime;
            pos.x += 200 * Time.deltaTime;

            if (pos.z < -1500)
            {
                pos.z = 0;
                pos.x = -962f;
            }

            testList[i].transform.localPosition = pos;
            testList[i].depth = (int)pos.z * -1;
        }
	}
}
